<div class="bodywrap" style="margin:0;padding:0">   
  <div style="position:absolute; top:0px; right:0; z-index:1;">      
    <div>       
      <a rel="external" title="Home" href="<?php echo ApplicationConfig::getURL('', 'site', 'index');?>">          
        <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/home.png" alt="Home" width="36px" height="36px"/>       </a>     
    </div>   
  </div>   
  <?php $path= Yii::app()->request->baseUrl; ?> 	 
<?php     if(!empty($pages))    {     
$totalpagesize=sizeof($pages);	    
$pages[$totalpagesize]['image']="";	    
$pages[$totalpagesize]['description']="";      
foreach ($pages as $key=>$page)      {  
  ?> 	         
  <div style="margin:0;padding:0" data-role="page" id="<?php echo $key+1;?>" data-theme="e" class="searchPage" data-url="page=<?php echo $key+1;?>">           
    <div data-role="content" style="margin:0;padding:0">            
      <ul data-role="listview" data-inset="true" data-theme="e" style="margin:0;padding:0">              
        <li id="listitem" style="margin:0;padding:0; border:0">                
          <?php                  if($key==$totalpagesize)                  {                     $nextchap = Chapter::model()->getModel('NEXT-CHAPTER-ID',array('subjectid'=>$objchapter->subject_id,'order'=>$objchapter->order));                    if($nextchap)                    {                      $nextchapid= $nextchap->id;                    }                    else                    {                      $nextchapid = $objchapter->subject_id;                    }                ?>                
          <div class="quizimg" style="margin:0;padding:0">                     
            <div>                    
              <div class="quizbutton">                      
                <div class="header">                        
                  <?php if($this->pageindexname=="postQuizDetails" ){?>                          
                  <div class="backtop">
                    <a rel="external" href="<?php echo ApplicationConfig::getURL('', 'site', 'viewQuiz',array('chapter'=>$this->chapterid));?>">
                      <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/back_button.png" alt="back" /></a>
                  </div>                        
                  <?php }elseif($this->pageindexname!="login" && $this->pageindexname!="playquiz"){?>        	                 
                  <div class="backtop">
                    <a data-rel="back">
                      <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/back_button.png" alt="home" /></a>
                  </div>                        
                  <?php }else {?>                           
                  <div class="backtop"> 
                  </div>                         
                  <?php } ?>                            
                  <h1 style="margin:0 !important">
                    <div class="logo">
                      <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/school_in_mobile_logo.png" alt="school in mobile" align="left" style="margin-right:1px;"/>School in Mobile
                    </div></h1>                        
                  <div class="hometop">                          
                    <a rel="external" href="<?php echo ApplicationConfig::getURL('', 'site', 'index');?>">                            
                      <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/home.png" alt="home" />                          </a>                        
                  </div>	                    
                </div>                      
                <div style="margin-top:5%"><h1>You reached end of the Tutorial for this chapter.</h1>
                </div>                      
                <div style="position:relative; padding:5%; color:#fff;">                          
                  <?php 	$quizdetails1=Quiz::getList('CHAPTER-ID', array('chapterid'=>$objchapter['id']));                          if(!empty($quizdetails1)){                          ?>                        
                  <div style="position:relative; padding:2%;">                          
                    <a data-icon="arrow-r" rel="external" href="<?php echo ApplicationConfig::getURL('', 'site', 'viewQuiz',array('chapter'=>$objchapter['id']))?>" data-role="button" class="ui-btn-right" data-theme="e" style="width:98%">
                      <?php echo "Quiz";?></a>                        
                  </div>                        <br clear="all"/>                        
                  <?php }?>                        
                  <div style="position:relative; padding:2%;">                          
                    <a  rel="external" data-icon="arrow-r" href="<?php echo ApplicationConfig::getURL('', 'site','viewchapter',array('chapter'=>$objchapter->id));?>" data-role="button" class="ui-btn-right" data-theme="e" >Chapter Home</a>                        
                  </div>                        <br clear="all"/>		                    
                  <div style="position:relative; padding:2%;">		                    
                    <?php if($nextchapid == $objchapter->id){ ?>		                     
                    <a  rel="external" data-icon="arrow-r" href="<?php echo ApplicationConfig::getURL('', 'site', 'index',array('subjectnum'=>$nextchapid));?>"  data-role="button" class="ui-btn-right" data-theme="e" >Chapter List</a>		                    	
                    <?php }else{?> 		                    
                    <a  rel="external" data-icon="arrow-r" href="<?php echo ApplicationConfig::getURL('', 'site', 'viewchapter',array('chapter'=>$nextchapid));?>"  data-role="button" class="ui-btn-right" data-theme="e" > Next Chapter </a>		                    	
                    <?php }?>                         
                  </div>                        <br clear="all"/>                      
                </div>                       
                <div class="header1">                         
                  <div id="sharebox" style="position:absolute; bottom:100%; padding:1%; color:#fff; text-shadow: 0 1px 1px #000; width:98%; background:url(http://techanveshan.com/eduapp/images/blackbg.png)">                           
                    <div class="backtop"> 
                      <a rel="external" title="facebook" href="http://www.facebook.com/pages/SchoolinMobile/234910576589469">
                        <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/facebook.png" alt="facebook" width="36px" height="36px"/></a>
                    </div>                           
                    <div class="backtop"> 
                      <a rel="external" title="Twitter" href="https://twitter.com/SchoolinMobile">
                        <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/twitter.png" alt="twitter" width="36px" height="36px"/></a>   
                    </div>                           
                    <div class="backtop"> 
                      <a rel="external" title="Youtube" href="http://www.youtube.com/user/SchoolinMobile">
                        <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/youtube.png" alt="youtube" width="36px" height="36px"/></a> 
                    </div>                           
                    <div class="backtop">
                      <a rel="external" title="Googleplus" href="https://plus.google.com/111314304213657506262/about">
                        <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/googleplus.png" alt="googleplus" width="36px" height="36px"/></a> 
                    </div>                           
                    <div class="backtop"> 
                      <a rel="external" title="Refer a Friend" href="<?php echo ApplicationConfig::getURL('', 'site','referal');?>">
                        <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/system.png" alt="Refer a Friend" width="36px" height="36px"/></a> 
                    </div>                        
                  </div>                        
                  <div class="backtop">
                    <a rel="external" href="<?php echo ApplicationConfig::getURL('', 'site', 'settings');?>">
                      <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/settings.png" alt="home" width="36px" height="36px"/></a>
                  </div>                        <h1>
                    <div class="logo">
                    </div></h1>                        
                  <div class="hometop">
                    <a onclick="displayshare()">
                      <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/share1.png" alt="home"  width="34px" height="32px"/></a>
                  </div>	                   
                </div>	                  
              </div>                   
            </div>                  
          </div>                    
          <?php }else{?>                
          <div  style="margin:0;padding:0">                  
            <div id="numberlist" class="header_page" style="margin:0;padding:0" >                    
              <h3 style="background: #febc6a; min-height:30px; padding-left:1%; line-height:30px; margin:0;">
                <?php echo $page['title']; ?><h3>                  
            </div>                  
            <?php if($page['image']){?>                    
            <?php                                       //list($width, $height, $type, $attr) = getimagesize("http://techanveshan.com/eduapp/images/page/".$page['image']);                      $width="100%";                      $height="100%";                      if($width>$height)                      {                          $width="100%";                          $height="100%";                       }                       else                       {                          $width="100%";                          $height="100%";                       }                                                                    ?>                   
            <img id="pageimage<?php echo $key+1;?>" src="<?php echo ApplicationConfig::getImageUrl("PAGE-IMAGES", array('file_name'=>$page['image']));?>" height="100%" width="100%" style="margin-bottom:30px" />                          
            <?php }else{?>				            
            <img id="pageimage<?php echo $key+1;?>" src="<?php echo ApplicationConfig::getImageUrl("PAGE-IMAGES", array('file_name'=>'no_preview.jpg'));?>"  height="100%" width="100%" style="margin-bottom:30px"/>				          	
            <?php }?>				     
     					                            
            <div id="numberlist" class="header1" style=" color:#fff; text-shadow: 0 1px 1px #000; text-align:center; background:url(http://techanveshan.com/eduapp/images/blackbg.png) ">                    
              <div class="backtop" style="margin-left: 1%;">
                <div id="leftbutton"> 
                  <a rel="external" title="Previous" onclick="process_previous_action()">
                    <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/left_grey.png" alt="" width="36px" height="36px"/></a>
                </div>
              </div>                     
              <div class="backtop" style="margin-left: 23%;">  
                <?php $onenum=$key+1;$totalpages=$totalpagesize;echo $onenum."/".$totalpages; ?>
              </div>                    
              <div class="hometop">
                <a rel="external" title="Next" onclick="process_next_action()">
                  <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/right_grey.png" alt="" width="36px" height="36px"/></a> 
              </div>                   
            </div>                  
            <div id="description<?php echo $key+1;?>" style="position:absolute; bottom:25%; padding:1%; color:#fff; font-size:0.95em; font-weight: normal; text-shadow: 0 1px 1px #000; width:98%; background:url(http://techanveshan.com/eduapp/images/blackbg.png) ">
              <?php echo strip_tags($page['description']); ?>
            </div>                
          </div>                
          <?php }?>			        
        </li>            
      </ul>          
    </div>        
  </div>        
  <?php }?>         
  <span id="previndex" data-index="<?php echo $key-1;?>">
  </span>        
  <span id="nextindex" data-index="<?php echo $key+1;?>">
  </span>        
  <span id="currentchapter" data-index="<?php echo $objchapter->id;?>">
  </span>                
  <div id="jquery_jplayer_1" class="jp-jplayer">
  </div>            
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/soundmanager2.js"></script>         
<script type="text/javascript">    soundManager.url = "<?php echo Yii::app()->request->baseUrl; ?>/swf/"; // directory where SM2 .SWFs live  // SM2 has loaded - now you can create and play sounds!var sound_manager = 0;var mySound1;var mySound2;var mySound3;var mySound4;soundManager.onready(function(){  sound_manager = 1;   mySound1 = soundManager.createSound({    id: 'aSound1',    url: "<?php echo Yii::app()->request->baseUrl; ?>/mp3/8HistoryChap2_p1.mp3",    // onload: myOnloadHandler,    // other options here..    onfinish: function() {    	//mySound2.play();      change_read_flag_status('READING_ENDED');    	  }	  });        mySound2 = soundManager.createSound({    id: 'aSound2',    url: "<?php echo Yii::app()->request->baseUrl; ?>/mp3/8HistoryChap2_p2.mp3",    // onload: myOnloadHandler,    // other options here..    onfinish: function() {    	//mySound3.play();      change_read_flag_status('READING_ENDED');    	  }	  });       mySound3 = soundManager.createSound({    id: 'aSound3',    url: "<?php echo Yii::app()->request->baseUrl; ?>/mp3/8HistoryChap2_p3.mp3",    // onload: myOnloadHandler,    // other options here..    onfinish: function() {    	//mySound4.play();      change_read_flag_status('READING_ENDED');    	  }	  });   mySound4 = soundManager.createSound({	    id: 'aSound4',	    url: "<?php echo Yii::app()->request->baseUrl; ?>/mp3/8HistoryChap2_p4.mp3",	    // onload: myOnloadHandler,	    // other options here..	    onfinish: function() {	    		   change_read_flag_status('READING_ENDED');	    	  }		  });      }); function stopMP3(){soundManager.onready(function(){   soundManager.stopAll();    });  }</script>                
<script>         document.getElementById('leftbutton').style.display="none";             var current_page_num = 1;             var totalpagecount   = <?php echo sizeof($pages);?>;             var movie_mode_phone = "off";             //alert(movie_mode_phone);             var temp_movie_mode_status;             if(movie_mode_phone == "on")             {                temp_movie_mode_status = "ON";                //playMP3();             }             else             {                temp_movie_mode_status = "OFF";             }             //temp_movie_mode_status = "OFF";   // hard coded for testing, should be based on user selection             var current_page_read_status = "LOADED";             var running_mode = "LIVE";         // LIVE for tts ,   TEST otherwise             var player_type = "DEFAULT";       // DEFAULT for Andriod tts, * otherwise             var tim1;             var tim2;             var pause_image = "<?php echo Yii::app()->getBaseURL(true); ?>/images/pause.png";             var play_image = "<?php echo Yii::app()->getBaseURL(true); ?>/images/play.png";                          function move_to_next_page()             {            	 npage=current_page_num+1;                 if(npage<=totalpagecount)                      {                	 current_page_num=npage;                    	$.mobile.changePage($('#'+npage), 'slide');                    }	              }             function move_to_previous_page()             {            	 ppage = current_page_num-1;            	 if(ppage>=1)             		{            			current_page_num = ppage;            		 	$.mobile.changePage($('#'+ppage), 'slide');                    }            	 if(ppage==1)              	{                 document.getElementById('leftbutton').style.display="none";             	}             }                          function start_reading()             {            	   var idname="description"+current_page_num;                 var text=document.getElementById(idname).innerHTML;                   if(running_mode == "TEST")                 {                     //alert(text);                                          //alert(temp_string);                     //mySound1.play();                     //alert("Sound Manager: " + sound_manager);                                      }                 else                 {                 //alert("test");                 var temp_string = "mySound"+current_page_num+".play();";                 eval(temp_string);                 //HTMLOUT.speaktext(text,player_type);                 }             }                         function stop_reading()             {                 if(running_mode == "TEST")                 {            	 	 //alert("Stop Reading");                 }                 else                 {                	 //HTMLOUT.stoptext();                 }             }                          function process_next_action()             {            	 //alert("Next Hit");            	 move_to_next_page();            	 if(temp_movie_mode_status == "ON")            	 {            		 toggle_movie_mode();            		 start_reading();            	 }                         }                         function process_previous_action()             {            	 //alert("Previous Hit");            	 move_to_previous_page();            	 if(temp_movie_mode_status == "ON")            	 {            		 toggle_movie_mode();            		 start_reading();            	 }             }                                       function toggle_movie_mode()             {            	            	 var ele_start_stop_image_id = document.getElementById('start_stop_image_id');             	             	 if(temp_movie_mode_status == "ON")            	 {            		 temp_movie_mode_status = "HOLD";            		 ele_start_stop_image_id.src = play_image;            		 clear_timers();            		 stop_reading();            		 //stopMP3();            	 }            	 else if(temp_movie_mode_status == "HOLD")            	 {            		            		 ele_start_stop_image_id.src = pause_image;            		 temp_movie_mode_status = "ON";            		             		 if(current_page_read_status == "READING_STARTED" || current_page_read_status == "LOADED")            		 {            			 start_reading();            			 //playMP3();                          		 }            		 start_timers();             		            	 }            		              }                         $('div.ui-page').live("swipeleft", function(){            	 process_next_action();             });             $('div.ui-page').live("swiperight", function(){             	 process_previous_action()             });                         function run_movie_mode()             {            	 if(current_page_read_status == "LOADED")            	 {            		 current_page_read_status = "READING_STARTED";            		 start_reading();            	 }                        	 if(current_page_read_status == "READING_ENDED")            	 {            		 move_to_next_page();            		 current_page_read_status = "READING_STARTED";            		 start_reading();            	 }            	 if(current_page_num == totalpagecount || temp_movie_mode_status == "OFF")            	 {            		 clear_timers();            	 }             }			                         function clear_timers()             {            	 	//alert("CLEAR TIMER");             		tim1 = window.clearInterval(tim1);            		 if(running_mode == "TEST")                 {            		tim2 = window.clearInterval(tim2);            		}             }	             function start_timers()             {            	 	//alert("START TIMER");             	 	tim1 = self.setInterval("run_movie_mode()",1000);             	 	 if(running_mode == "TEST")                 {            		tim2 = self.setInterval("change_read_flag_status('READING_ENDED')",8000);            		}             }	             function change_read_flag_status(value)             {            	// alert("Change Status: " + value);            	 current_page_read_status = value;            	              }	                          function run_app()             {            	 var ele_start_stop_container = document.getElementById('moviemode');             	 var ele_start_stop_image_id = document.getElementById('start_stop_image_id');               //alert(temp_movie_mode_status);              	 if(temp_movie_mode_status == "ON")            	 {            		 ele_start_stop_container.style.display = "";            		 ele_start_stop_image_id.src = pause_image;            		 start_timers();            	 }            	 else            	 {            		 ele_start_stop_container.style.display = "none";            	 }	              }             /**************************************************/                          window.onload = run_app;          </script>         
<script type="text/javascript">          $("#listitem").swiperight(function() {             $.mobile.changePage("#page1");        });         </script>         
<script type="text/javascript">                  function resize(image)            {                var differenceHeight = document.body.clientHeight - image.clientHeight;                var differenceWidth  = document.body.clientWidth  - image.clientWidth;                if (differenceHeight < 0) differenceHeight = differenceHeight * -1;                if (differenceWidth  < 0) differenceWidth  = differenceWidth * -1;                        if (differenceHeight > differenceWidth)                {                    image.style['height'] = document.body.clientHeight + 'px';                }                else                {                    image.style['width'] = document.body.clientWidth + 'px';                }                        // Optional: remove margins or compensate for offset.                image.style['margin'] = 0;                document.body.style['margin'] = 0;            }            function setimage(width,height)            {                                 var yourImg = document.getElementById('pageimage1');                if(yourImg && yourImg.style) {                   //yourImg.style.height = height;                   // yourImg.style.width = width;                }                    }           </script>            
<script type="text/javascript">             document.getElementById("sharebox").style.display="none";              function displayshare()            {              var displaybox1=document.getElementById("sharebox");                if(displaybox1.style.display=="none")               {                  displaybox1.style.display="block";               }               else if(displaybox1.style.display=="block")               {                  displaybox1.style.display="none";               }            }        </script> 
  <?php }else{ ?> 
  <div data-role="page" id="<?php echo $key+1;?>" data-theme="e" class="searchPage" data-url="page=<?php echo $key+1;?>">     
    <div data-role="content" style="margin:0;padding:0">       
      <ul data-role="listview" data-inset="true" data-theme="e" style="margin:0;padding:0">          
        <li id="listitem" style="margin:0;padding:0; border:0">              
          <div class="quizimg" style="margin:0;padding:0">                     
            <div>                     
              <div class="quizbutton">                        
                <div class="header">                          
                  <?php if($this->pageindexname=="postQuizDetails" ){?>                            
                  <div class="backtop">
                    <a rel="external" href="<?php echo ApplicationConfig::getURL('', 'site', 'viewQuiz',array('chapter'=>$this->chapterid));?>">
                      <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/back_button.png" alt="back" /></a>
                  </div>                          
                  <?php }elseif($this->pageindexname!="login" && $this->pageindexname!="playquiz"){?>        	                   
                  <div class="backtop">
                    <a data-rel="back">
                      <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/back_button.png" alt="home" /></a>
                  </div>                          
                  <?php }else {?>                            
                  <div class="backtop"> 
                  </div>                           
                  <?php } ?>                              
                  <h1 style="margin:0 !important">
                    <div class="logo">
                      <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/school_in_mobile_logo.png" alt="school in mobile" align="left" style="margin-right:1px;"/>School in Mobile
                    </div></h1>                          
                  <div class="hometop">
                    <a rel="external" href="<?php echo ApplicationConfig::getURL('', 'site', 'index');?>">
                      <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/home.png" alt="home" /></a>
                  </div>	                      
                </div>                        
                <div style="margin-top:10%">Sorry there are no pdfs under this chapter.
                </div>                        
                <div style="position:relative; padding:5%; color:#fff;">                           <br clear="all"/>                        
                </div>                         
                <div class="header1">                          
                  <div id="sharebox" style="position:absolute; bottom:100%; padding:1%; color:#fff; text-shadow: 0 1px 1px #000; width:98%; background:url(http://techanveshan.com/eduapp/images/blackbg.png)">                            
                    <div class="backtop"> 
                      <a rel="external" title="facebook" href="http://www.facebook.com/pages/SchoolinMobile/234910576589469">
                        <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/facebook.png" alt="facebook" width="36px" height="36px"/></a>
                    </div>                            
                    <div class="backtop"> 
                      <a rel="external" title="Twitter" href="https://twitter.com/SchoolinMobile">
                        <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/twitter.png" alt="twitter" width="36px" height="36px"/></a>   
                    </div>                            
                    <div class="backtop"> 
                      <a rel="external" title="Youtube" href="http://www.youtube.com/user/SchoolinMobile">
                        <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/youtube.png" alt="youtube" width="36px" height="36px"/></a> 
                    </div>                            
                    <div class="backtop">
                      <a rel="external" title="Googleplus" href="https://plus.google.com/111314304213657506262/about">
                        <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/googleplus.png" alt="googleplus" width="36px" height="36px"/></a> 
                    </div>                            
                    <div class="backtop"> 
                      <a rel="external" title="Refer a Friend" href="<?php echo ApplicationConfig::getURL('', 'site','referal');?>">
                        <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/system.png" alt="Refer a Friend" width="36px" height="36px"/></a> 
                    </div>                          
                  </div>                          
                  <div class="backtop">
                    <a rel="external" href="<?php echo ApplicationConfig::getURL('', 'site', 'settings');?>">
                      <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/settings.png" alt="home" width="36px" height="36px"/></a>
                  </div>                          <h1>
                    <div class="logo">
                    </div></h1>                          
                  <div class="hometop">
                    <a onclick="displayshare()">
                      <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/share1.png" alt="home"  width="34px" height="32px"/></a>
                  </div>	                      
                </div>	                   
              </div>                                  
            </div>                              
          </div>                           
        </li>          
      </ul>        
    </div>     
  </div> 
  <?php }?> 
</div> 